let num: number = 12
console.log(num);

type countStr = number | string; // 类型别名
let str: countStr = 'hello'

let arr: Array<string> = ['hello'];
let arr1: number[] = [1, 2, 3]

// 定义对象
// 类型别名
type ObjInfo = {
    name: string,
    age: number
}

let obj: ObjInfo = {
    name: '小花',
    age: 18,
}


// 类型别名可以在函数或方法的参数中使用，但是不能在类的成员变量
type routesItem = {
    path: string,
    component: string,
    children: routesItem[]
}
let routes: routesItem[] = [
    {
        path: '/2206A',
        component: 'index',
        children: [
            {
                path: '/2206A/2207A',
                component: 'indeex',
                children: []
            },
        ]
    }
]

// type routesItem = {
//     path: string,
//     component: string,
// }
// let routes: routesItem[] = [
//     {
//         path: '/2206A',
//         component: 'index',
//     }
// ]

let foo: any = "12";


// 元组
let arr2: [number, string, boolean] = [1, 'aa', false]

// 枚举类型
enum Type {
    red = 'a',
    blue = 'b',
    green = 'c',
}

enum Type1 {
    red = 1,
    blue,
    green,
}
console.log(Type, "type")
console.log(Type.red)
// console.log(Type[1])

console.log(Type1, "type1")

// 类型断言 as
const box = document.getElementById('input')
console.log((box as HTMLInputElement).value);




export { }